#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char const *argv[])
{
    int fb = open("love.txt",O_RDONLY);
    if (fb == -1)
    {
        perror("错误信息1为");
        return -1;

    }
    int fb2 = open("love2.txt",O_CREAT|O_APPEND|O_WRONLY,0664);
    if (fb2 == -1)
    {
        close(fb);
        perror("错误信息2为");
        return -1;
    }

char buff[1024];
ssize_t love_cnt =0;
while ((read(fb,buff,sizeof(buff)))>0)
{
    write(fb2,buff,love_cnt);
    write(STDOUT_FILENO,buff,love_cnt);
}

if(love_cnt ==-1){
perror("错误信息3为");
close(fb);
close(fb2);
}

close(fb);
close(fb2);
    
    return 0;
}
